home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Mail / MailEnclosure / MESendModules / Source / PlainText / MailFromFile.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  788 b   |  44 lines

  1. #import "MailFromFile.h"
  2. #import "StringStorage.h"
  3. #import "FileName.h"
  4. #include <sys/file.h>
  5. #include <sys/types.h>
  6. #include <sys/uio.h>
  7.  
  8. @implementation MailFromFile
  9.  
  10. -initForMUA: (const char *)anApp  andMTA: (const char *)aMailer
  11. {
  12.    [super initForMUA: anApp andMTA: aMailer];
  13.    [mailFile setStringValue: "/tmp/.mail"];
  14.    [mailFile mktemp];
  15.    fp = fopen([mailFile stringValue], "a");
  16.    if(!fp)
  17.        NXLogError("Failed to open %s", [mailFile stringValue]);
  18.    return self;
  19. }
  20.  
  21. -free
  22. {
  23.    fclose(fp);
  24.    unlink([mailFile stringValue]);
  25.    return [super free];
  26. }
  27.    
  28. - buildBody
  29. {
  30.    [super buildBody];
  31.  
  32.    if(!fp)
  33.    {
  34.       NXLogError("Failed to open %s", [mailFile stringValue]);
  35.       return nil;
  36.    }
  37.  
  38.    fwrite([body stringValue],1,[body strlen],fp);
  39.    return self;
  40. }
  41.  
  42.  
  43. @end
  44.